-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #1715
base: master
Are you sure you want to change the base?
Solution #1715
Conversation
app/main.py
Outdated
else: | ||
raise ( | ||
TypeError(f"Unsupported operand type(s):" | ||
f" 'Distance' and {type(other)}") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add "else" because the other two conditions have "return", thus it'll never reach "else" statement if some "if" statement is run
def __add__(self, other: int | float) -> "Distance": | ||
if isinstance(other, Distance): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix annotation. "other" can also be Distance object
f" 'Distance' and {type(other)}") | ||
) | ||
|
||
def __iadd__(self, other: int | float) -> "Distance": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix annotation. "other" can also be Distance object
app/main.py
Outdated
else: | ||
raise TypeError(f"Unsupported operand type(s): " | ||
f"'Distance' and {type(other)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add "else" because the other two conditions have "return", thus it'll never reach "else" statement if some "if" statement is run
app/main.py
Outdated
else: | ||
raise TypeError(f"Unsupported operand type(s): " | ||
f"'Distance' and {type(other)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add "else" because the other two conditions have "return", thus it'll never reach "else" statement if some "if" statement is run
app/main.py
Outdated
else: | ||
raise TypeError(f"Unsupported operand type(s): " | ||
f"'Distance' and {type(other)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add "else" because the other two conditions have "return", thus it'll never reach "else" statement if some "if" statement is run
app/main.py
Outdated
else: | ||
raise ( | ||
TypeError(f"Unsupported operand type(s): " | ||
f"'Distance' and {type(other)}") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add "else" because the other two conditions have "return", thus it'll never reach "else" statement if some "if" statement is run
raise TypeError(f"Unsupported operand type(s): " | ||
f"'Distance' and {type(other)}") | ||
|
||
def __ge__(self, other: int | float) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix annotation. "other" can also be Distance object
raise TypeError(f"Unsupported operand type(s): " | ||
f"'Distance' and {type(other)}") | ||
|
||
def __le__(self, other: int | float) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix annotation. "other" can also be Distance object
raise TypeError(f"Unsupported operand type(s): " | ||
f"'Distance' and {type(other)}") | ||
|
||
def __eq__(self, other: int | float) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix annotation. "other" can also be Distance object
No description provided.